package com.bhs.sansong.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bhs.sansong.R;
import com.bhs.sansong.bean.MenuBean;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

//菜单适配器
public class MenuAdapter extends BaseQuickAdapter<MenuBean, BaseViewHolder> {


    public MenuAdapter(int layoutResId, @Nullable List<MenuBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, MenuBean menuBean) {
        baseViewHolder.setText(R.id.tv_name,menuBean.getMenuName()).setVisible(R.id.tv_name,menuBean.getMenuIcon()!=0);
        baseViewHolder.setImageResource(R.id.iv_icon,menuBean.getMenuIcon()).setVisible(R.id.iv_icon,menuBean.getMenuIcon()!=0);
    }
}
